package com.sskj.functions.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.functions.activity.BorrowMoneyRecordActivity;
import com.sskj.functions.presenter.BasePresenter;
import com.sskj.lib.Constans;
import com.sskj.lib.bean.BorrowMoneyRecordBean;
import com.sskj.lib.bean.FrashBean;
import com.sskj.lib.bean.SignInListBean;
import com.sskj.lib.http.JsonCallBack;

/**
 * @author Hey
 * Create at  2019/06/26
 */
public class BorrowMoneyRecordPresenter extends BasePresenter<BorrowMoneyRecordActivity> {
    public void getJbsxList (String type,String page,String size,boolean flag){
        httpService.getJbsxList(type,page,size)
                .tag(this)
                .execute(new JsonCallBack<HttpData<BorrowMoneyRecordBean>>(flag?this:null) {
                    @Override
                    public void onSuccess(Response<HttpData<BorrowMoneyRecordBean>> response) {
                        HttpData<BorrowMoneyRecordBean> body = response.body();
                        BorrowMoneyRecordBean data = body.getData();
                        mView.getJbsxListSuccess(data);
                    }

                    @Override
                    public void onFinish() {
                        super.onFinish();
                        mView.onStopRefresh();
                    }
                });
    }
    public void getFrashList(int s, int s1,boolean flag){
        httpService.getFrashList(s,s1)
                .tag(this)
                .execute(new JsonCallBack<HttpData<FrashBean>>(flag?this:null) {
                    @Override
                    public void onSuccess(Response<HttpData<FrashBean>> response) {
                        HttpData<FrashBean> body = response.body();
                        FrashBean data = body.getData();
                        mView.getRrashListSuccess(data);
                    }

                    @Override
                    public void onFinish() {
                        super.onFinish();
                        mView.onStopRefresh();
                    }
                });
    }
}
